package com.wkbb.sports.mapper;

import com.wkbb.common.base.BaseMapper;
import com.wkbb.sports.dto.ExcelDto2;
import com.wkbb.sports.dto.WebSocketInfoDto;
import com.wkbb.sports.dto.WorkStuDto;
import com.wkbb.sports.dto.WorkStudentHistoryForPcDto;
import com.wkbb.sports.model.HlifeWorkStudent;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author lbh
 * @date 2021年03月29日 17:58:34
 * @description:
 */
@Repository
public interface HlifeWorkStudentMapper extends BaseMapper<HlifeWorkStudent> {

    void insertBatch1(@Param("hlifeWorkStudentList") List<HlifeWorkStudent> hlifeWorkStudentList);

    String gethWorkStudentIds(@Param("workId") String workId);

//    已经做了该作业的学生人数
    String gethWorkStudentCount(@Param("workId") String workId);

//    查询某个作业已达标/未达标的学生
    List<HlifeWorkStudent>  gethWorkStudentDetail(@Param("workId") String workId,@Param("reached") String reached);

    void deleteWorkStudentByWorkId(@Param("workId") String workId);

    //    当前提交作业的学生的即时排名
    Long getStudentPosition(@Param("workId") String workId,@Param("studentId") String studentId);

    // 查询学生性别
    Integer getStudentSex(@Param("studentId") String studentId);

    //查询当前同一个排名的学生人数【并列排名】
    Long getStudentSamePositionCount(@Param("workId") String workId,@Param("position") String position);

    //查询某个指定作业的指定位置排名的学生们信息(in实现)
    List<Map<String,Object>>  getStudentByPosition(@Param("workId") String workId,@Param("positions") String positions);

    //查询某个指定作业的指定位置排名的学生们信息(between and 实现【效率更高】)
    List<Map<String,Object>>  getStudentByPosition2(@Param("workId") String workId,@Param("position1") String position1,@Param("position2") String position2,@Param("studentId") String studentId);

    //    当前作业的学生的排名
    List<Map<String,Object>> getStudentPositionOfWork(@Param("workId") String workId,@Param("studentId") String studentId);

    //    当前作业的学生的排名【前三名】
    List<Map<String,Object>> getStudentPositionOfWorkThird(@Param("workId") String workId,@Param("studentId") String studentId);

    //    当前作业的学生的排名【前两名】
    List<Map<String,Object>> getStudentPositionOfWorkSecond(@Param("workId") String workId,@Param("studentId") String studentId);

    //    查询出当前作业已经做的学生的成绩
    List<WebSocketInfoDto> getStudentScoreOfWork(@Param("workId") String workId);

    List<Map<String,Object>> getStudentWorkList(Map<String,Object> params);

    //查询某个学生所做的所有作业
    public List<WorkStudentHistoryForPcDto> gethWorkByStudentId(@Param("studentId") Long studentId);


 //===========================================PC端作业模块=============【begin】===============================================================
    //    查询某个作业已达标/未达标的学生
    //List<HlifeWorkStudent>  getWorkDetailStudentForPc(@Param("workId") String workId,@Param("reached") String reached,@Param("studentNo") String studentNo,@Param("studentName") String studentName,@Param("status") Integer status,@Param("sex") Integer sex);
    List<ExcelDto2>  getWorkDetailStudentForPc(@Param("workId") String workId, @Param("reached") String reached, @Param("studentNo") String studentNo, @Param("studentName") String studentName, @Param("status") Integer status, @Param("sex") Integer sex);

    List<WorkStuDto> getWorkStuList(@Param("workId") String workId);
    //List<Map<String,Object>>  getWorkDetailStudentForPc(@Param("workId") String workId,@Param("reached") String reached,@Param("studentNo") String studentNo,@Param("studentName") String studentName,@Param("status") Integer status,@Param("sex") Integer sex);



//===========================================PC端作业模块=============【end】===============================================================





}